<template>
  <h1>{{name}}</h1>
  {{name}}
  {{age}}
  <button @click="toParent">子传父</button>
</template>

<script>
export default {
  data(){
    return {
      name: "Lesson2-1",
    }
  },
  props:['name','age'],
  methods:{
    toParent(){
      this.$emit('getData',"你好，我是组件传过来的")
    }
  }
}
</script>

<style scoped>

</style>
